package cn.nexd.app.config.ui.activity;

import android.content.Intent;
import android.view.Window;
import android.view.WindowManager;

import java.util.Timer;
import java.util.TimerTask;

import cn.nexd.app.config.R;
import cn.nexd.app.config.presenter.LoadingPresenter;
import cn.nexd.app.config.ui.iView.IBaseView;

/**
 * Created by wangxu on 16/7/19.
 */
public class LoadingActivity extends FullScreenActivity<LoadingPresenter> implements IBaseView {

    @Override
    protected int getLayoutResId() {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        return R.layout.activity_loading;
    }

    @Override
    protected void initPresenter() {
        presenter = new LoadingPresenter(this, this);
        presenter.init();
    }

    @Override
    public void initView() {
        final Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                timer.cancel();
                LoadingActivity.this.startActivity(new Intent(LoadingActivity.this, SignInActivity.class));
                LoadingActivity.this.finish();
            }
        }, 3000);
    }

    @Override
    public void showToast(String msg) {

    }
}
